/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import exception.DuplicateConstraintException;
import exception.ExceptionInterceptor;
import exception.RemoveConstraintException;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.inject.Named;
import javax.interceptor.Interceptors;
import model.dao.ProfissionalDao;
import model.entidades.Profissional;

/**
 *
 * @author helton
 */
@Named
@Stateless
@Interceptors(ExceptionInterceptor.class)
public class ProfissionalController implements Serializable{
    @Inject
    ProfissionalDao profissionalDao;

    public Profissional insert(Profissional profissional) throws DuplicateConstraintException {
        profissionalDao.insert(profissional);
        return profissional;
    }

    public Profissional update(Profissional profissional) throws DuplicateConstraintException {
        profissionalDao.update(profissional);
        return profissional;
    }

    public void remove(Profissional profissional) throws RemoveConstraintException {
        profissionalDao.delete(profissional);
    }

    public List<Profissional> getAll() {
        return profissionalDao.getAll();
    }
}
